/*
批量处理的方法1
 */
import org.example.Calculator;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized.*;
import org.junit.runners.*;

import java.util.Arrays;
import java.util.Collection;
import static org.junit.jupiter.api.Assertions.*;
@RunWith(Parameterized.class)
public class BatchTest1 {
    private static Calculator calculator=new Calculator();
    private int param;
    private int result;

    //测试2*2=4,0*0=0,(-3)**2=9
    @Parameters
    public static Collection data(){
        return Arrays.asList(new Object[][]{{2,4},{0,0},{-3,9}});
    }
    public BatchTest1(int param, int result){
        this.param=param;
        this.result=result;
    }
    @Test
    public void square(){
        calculator.square(param);
        assertEquals(result,calculator.getResult());
    }
}